package com.qy127.controller;

import com.qy127.dao.StaffDao;
import com.qy127.entity.Staff;
import com.qy127.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/staf")
public class lizhiController {

    /**
     * 注入StaffDao
     */
    @Autowired
    private StaffDao staffDao;

    /**
     * 查询所有离职员工信息
     * @param staff
     * @return
     */
    @RequestMapping("/showOneStaffs")
    @ResponseBody
    public Result staffList(Staff staff){
        //System.out.println(staff);
        List<Map<String, Object>> allStaff = staffDao.getStaff(staff);
        int i = staffDao.getAllCount(staff);
        Result result = new Result(i, allStaff);
        return result;
    }
}
